#pragma once

// -- forward declaration
struct Vector4;

// =================================================================================================
// Basic mathematic implementation of Matrix4x4
// =================================================================================================
struct Matrix4x4 {
    
    union {
        struct {
            float m00, m01, m02, m03;
            float m10, m11, m12, m13;
            float m20, m21, m22, m23;
            float m30, m31, m32, m33;
        };
        float m[4][4];
    };

	// -- default constructor
	Matrix4x4();
	
	// -- create a 4x4 matrix with 16 floats
	Matrix4x4(float, float, float, float,
		      float, float, float, float,
			  float, float, float, float,
			  float, float, float, float);

	// -- create a 4x4 matrix with 4 row vectors
	Matrix4x4(Vector4*, Vector4*, Vector4*, Vector4*);

	// -- operator overloads
    Matrix4x4 operator*(Matrix4x4& m);
    Matrix4x4 operator*=(Matrix4x4& m);
    Matrix4x4 operator+(Matrix4x4& m);
    Matrix4x4 operator+=(Matrix4x4& m);
};

// ==================================================================================================
// Default Constructor
// ==================================================================================================
inline Matrix4x4::Matrix4x4() {
	m00 = 0.0f;
	m01 = 0.0f;
	m02 = 0.0f;
	m03 = 0.0f;
	m10 = 0.0f;
	m11 = 0.0f;
	m12 = 0.0f;
	m13 = 0.0f;
	m20 = 0.0f;
	m21 = 0.0f;
	m22 = 0.0f;
	m23 = 0.0f;
	m30 = 0.0f;
	m31 = 0.0f;
	m32 = 0.0f;
	m33 = 0.0f;
}


// =================================================================================================
// Return a simple 4x4 identity matrix
// =================================================================================================
inline Matrix4x4 Identity() { 
    Matrix4x4 temp;

	temp.m00 = 1.0f;
	temp.m11 = 1.0f;
	temp.m22 = 1.0f;
	temp.m33 = 1.0f;

    return temp;
}

